package com.sky.controller.user;

import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.result.Result;
import com.sky.service.SetmealService;
import com.sky.vo.DishItemVO;
import com.sky.vo.DishVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("userSetmealController")
@RequestMapping("/user/setmeal")
@Slf4j
@Api(tags = "C端-套餐浏览接口")
public class SetmealController {
        @Autowired
        private SetmealService setmealService;

    /**
     * 根据分类ID查询套餐
     * @param list
     * @return
     */
    @GetMapping("/list")
    @ApiOperation("根据分类Id查询套餐")
    public Result<List<Setmeal>> getSetmeal(Long list){
        List<Setmeal> setmeal = setmealService.getSetmeal(list);

        return Result.success(setmeal);
    }
    /**
     * 根据套餐id查询菜品
     */
    @ApiOperation("根据套餐id查询菜品")
    @GetMapping("/dish/{id}")
    public Result<List<DishItemVO>> getSetmealId(@PathVariable Long id){
        log.info("根据套餐id查询菜品:{}",id);
        List<DishItemVO> setmealDish = setmealService.getSetmealDish(id);

        return Result.success(setmealDish);
    }
}
